import request from '@/utils/request'

/**
 * 查--获取用户列表
 * @param {*} params
 * @returns
 */
export const getUserListAPI = (params) => {
  return request({
    method: 'get',
    url: '/users',
    params
  })
}

/**
 * 增--新用户
 */
export const addUserAPI = (data) => {
  return request({
    method: 'post',
    url: '/users',
    data
  })
}

/**
 * 删--除用户
 */
export const delUserAPI = (id) => {
  return request({
    method: 'delete',
    url: `/users/${id}`,
    data: {
      id
    }
  })
}

/**
 * 查-用户详情
 */
export const getUserDetailAPI = (id) => {
  return request({
    method: 'get',
    url: `/users/${id}`,
    params: {
      id
    }
  })
}

/**
 * 改--编辑用户
 */
export const putUserInfoAPI = (id, form) => {
  return request({
    method: 'put',
    url: `/users/${id}`,
    data: form
  })
}
